import React, { Component } from "react";
import { observer, inject } from "mobx-react";


@inject("homeStore", "userStore", "pageStore")
@observer
class UserView extends Component {
  constructor(props) {
    super(props);
    this.state = {};
    this.props.pageStore.setPageName("子页面")
  }
  render() {
    return (
      <div>
        <h1>{this.props.pageStore.pageName}</h1>
        <h3>首页数据源的number为:{this.props.homeStore.currentNumber}</h3>
        <div>页码计算属性总数量:{this.props.homeStore.total}</div>
        <hr />
        <div>城市:{this.props.userStore.cityName.get()}</div>
        <button onClick={() => { this.props.history.push("/"); }} style={{ marginRight: 10 }}>
          跳转到首页
        </button>
        <button onClick={() => {
          this.props.userStore.cityName.set("杭州")
        }}>改变所在的城市</button>
        <hr />
        <input type="text" onChange={(e) => {
          this.props.homeStore.total = e.target.value
        }} />
      </div>
    );
  }
}
export default UserView
